package com.kefu.chat.smart;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.kefu.chat.model.ChatUser;
import com.kefu.chat.vo.ChatUserParam.UserConnectP;
import com.kefu.chat.vo.ChatUserParam.UserConnectR;
import com.kefu.common.trigger.Condition;
import com.kefu.common.trigger.TriggerWrapper;
import com.kefu.common.trigger.condition.SmartCondition;
import com.kefu.crm.model.CrmCustomer;
	
public interface ChatConnectCondition<R> extends SmartCondition<UserConnectP,UserConnectR, R>{
	default String type() {
		return ChatConnectEvent.TYPE;
	}

	default void filter(QueryWrapper<?> wrapper, Condition condition) {

	}

	
	default  ChatUser getChatUser(TriggerWrapper<UserConnectP,UserConnectR> wrapper) {
		return (ChatUser)wrapper.getMap().get("chatUser");
	}
	default  CrmCustomer getCustomer(TriggerWrapper<UserConnectP,UserConnectR> wrapper) {
		return (CrmCustomer)wrapper.getMap().get("customer");
	}
	
	default String getMessageCodePrefix() {
		return "smart.chat.condition."+getCode()+".";
	}
	default String getMessageName() {
		return getMessage("smart.chat.condition."+getCode(),getName());
	}
}
